/*
 * AudioMediaSink.h
 *
 *  Created on: 2020年8月15日
 *      Author: chuan
 */

#ifndef AUDIOMEDIASINK_H_
#define AUDIOMEDIASINK_H_

#include "UMediaSource.h"


class AudioMediaSink
{
public:
    virtual ~AudioMediaSink() {}

    virtual void onAudioFormat(const UMediaFormat& fmt) =0;
    virtual void onAudioPacket(UMediaPacket& pkt) =0;
    virtual void onAudioEvent(int event) =0;

};


class AudioLinkMediaSink : public UMediaSink
{
public:
    explicit AudioLinkMediaSink(AudioMediaSink* sink=nullptr):
        m_sink(sink)
    {
    }

    virtual ~AudioLinkMediaSink()
    {
    }

    virtual void onMediaFormat(const UMediaFormat& fmt)
    {
        m_sink->onAudioFormat(fmt);
    }

    virtual void onMediaPacket(UMediaPacket& pkt)
    {
        m_sink->onAudioPacket(pkt);
    }

    virtual void onMediaEvent(int event)
    {
        m_sink->onAudioEvent(event);
    }


    void setSink(AudioMediaSink* sink)
    {
        m_sink = sink;
    }

    AudioMediaSink*    m_sink;
};


#endif /* AUDIOMEDIASINK_H_ */
